package com.gmrz.uas.plugin.caservice;

import com.gmrz.uas.plugin.authservice.exception.InvalidConfigException;
import com.gmrz.uas.plugin.caservice.bean.CertBean;
import com.gmrz.uas.plugin.caservice.bean.CertTransactionTextBean;
import com.gmrz.uas.plugin.caservice.bean.P10Bean;
import com.gmrz.uas.plugin.caservice.bean.P7Bean;
import com.gmrz.uas.plugin.exception.PluginException;
import com.gmrz.uas.plugin.provider.ServiceProvider;

import java.io.UnsupportedEncodingException;
import java.util.Map;

/**
 * Created by gongyuqiang on 2017/5/13.
 */
public interface CertServicePlugin {

    /**
     * 获取插件Id
     * @return
     */
    String getPluginId();

    /**
     * 设置uas provider
     * @param provider
     */
    void setServiceProvider(ServiceProvider provider);
    /**
     * 获取插件配置
     * @return
     */
    Map<String, String> getAllConfig();

    /**
     * 设置系统配置
     * @param allConfig
     */
    void setAllConfig(Map<String, String> allConfig) throws InvalidConfigException;

    CertBean createCert(P10Bean p10Bean) throws PluginException;

    boolean verifySignature(P7Bean p7Bean) throws PluginException, UnsupportedEncodingException;

    //byte[] revokeCert(CertBean certBean) throws PluginException;
    byte[] revokeCert(CertBean certBean,String appId) throws PluginException;

    CertTransactionTextBean getCertTransactionText(String transactionText) throws PluginException;

    Map<String,String> getDN(String dn) throws PluginException;
}
